<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<style type="text/css">
.tdh {
	font-size: 16px;
	text-align: center;
	height: 30px;
}

.thd {
	font-size: 16px;
	text-align: center;
	background-color: lightblue;
}

table {
	width: 100%;
}
</style>
<script type="text/javascript">
	function choseCategory(id, categoryName) {
		onCategoryChoosed(id, categoryName);
		addCategoryDialog.close();
	}
</script>
<div>
	<div>
		<div class="row">
			<table border="1px" style="table-layout: fixed;">
				<thead>
					<tr>
						<th width="5%" class="thd"><input type="checkbox"
							hidden="hidden" />选择</th>
						<th width="15%" class="thd">分类ID</th>
						<th width="20%" class="thd">分类名称</th>
					</tr>
				</thead>
				<tbody>
					<c:if test="${fn:length(categoryList) > 0}">
						<c:forEach items="${categoryList}" var="category" varStatus="s">
							<tr
								onclick="choseCategory('${category.categoryId}','${category.categoryName}')">
								<td class="tdh"><input type="checkbox" name="check"
									value="${category.categoryId}" /></td>
								<td class="tdh">${category.categoryId}</td>
								<td class="tdh">${category.categoryName}</td>
							</tr>
							<c:forEach items="${category.children}" var="categoryc"
								varStatus="s">
								<tr
									onclick="choseCategory('${categoryc.categoryId}','${categoryc.categoryName}')">
									<td class="tdh"><input type="checkbox" name="check"
										value="${categoryc.categoryId}" /></td>
									<td class="tdh">${categoryc.categoryId}</td>
									<td class="tdh">${categoryc.categoryName}</td>
								</tr>
							</c:forEach>
						</c:forEach>
					</c:if>

				</tbody>
			</table>
		</div>
	</div>
</div>
